﻿@model List<Super.DomainService.SellItems>
@{
    Layout = null;
}
<script language="javascript" src="/Areas/Admin/Assets/script/LodopFuncs.js"></script>
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width="0" height="0">
    <embed id="LODOP_EM" type="application/x-print-lodop" width="0" height="0"></embed>
</object>
<div id="printArea" style="display: none;">
    <style type="text/css">
        .Printpanel { width: 240px; font-size: 12px; }
        .Printpanel table { font-size: 12px; }
        .Printpanel td { text-align: left; }
        .logo { text-align: center; font-size: 18px; font-weight: bold; }
        .Title label { text-align: left; }
        .line { border-color: black; clear: both; display: block; overflow: hidden; text-indent: -1000px; width: auto; height: 1px; padding: 4px 0 0 0; margin-bottom: 5px; border-style: dotted; border-width: 0 0 1px 0; }
        .Info .item { width: 120px; float: left; }
        .welcome { text-align: center; }
        .foot .item { line-height: 18px; text-align: center; }
    </style>
    <div class="Printpanel">
        <div class="logo">
            精诚科技</div>
        <div class="line">
        </div>
        <div class="line">
        </div>
        <table>
            <thead>
                <tr>
                    <th width="150">名称</th>
                    <th width="50">单价</th>
                    <th width="50">数量</th>
                    <th width="50">小计</th>
                </tr>
            </thead>
            <tbody>
                @{
                    foreach (var item in Model)
                    {
                    <tr>
                        <td>@item.ProductName</td>
                        <td>@item.Price</td>
                        <td>@item.Count</td>
                        <td>@(item.Price*item.Count)</td>
                    </tr>
  
                    }
                }
              
            </tbody>
        </table>
        <div class="line">
        </div>
        <div class="Info">
            <div class="total">
                <label>合计：</label> <span>@ViewBag.totalMoney</span>
            </div>
            <div class="item">
                <label>优惠：</label> <span id="youhui"></span>
            </div>
            <div class="item">
                <label>实收：</label> <span id="shishou"></span>
            </div>
            <div class="item">
                <label>收款：</label> <span id="shoukuan"></span>
            </div>
            <div class="item">
                <label>找零：</label> <span id="zhaoling"></span>
            </div>
            <div class="line">
            </div>
            <div >
                <label>编号：</label> <span>@ViewBag.OrderNo</span>
            </div>
            <div >
                <label>时间：</label> <span>@ViewBag.OrderTime</span>
            </div>
        </div>
        <div class="line">
        </div>
        <div class="caption">
            <p><label>说明：</label> 保修期内凭此小票，保修！请您妥善保管此小票！ </p>
        </div>
        <div class="line">
        </div>
        <div class="foot">
            <div class="welcome">
                欢迎光临，谢谢惠顾！</div>
            <div class="item">
                <label>联系电话：</label> <span>15189799192</span>
            </div>
            <div class="item">
                <label>联系地址：</label> <span>石榴镇三里村七组</span>
            </div>
        </div>
    </div>
</div>
<div class="pageContent">
    <form method="post" action="admin/pos/pay" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
        <div class="pageFormContent" layouth="56">
            <input type="hidden" value="@ViewBag.OrderTime" name="OrderTime"/>
            <p><label>账单金额：</label> <input name="sn" type="text" id="totalMoney" size="30" value="@ViewBag.totalMoney" readonly="readonly"/> </p>
            <div class="divider">
            </div>
            <p><label>优惠金额：</label> <input name="LetMoney" type="text" id="LetMoney" size="30" value="" /> </p>
            <p><label>实收金额：</label> <input name="ShouldMoney" type="text" id="ShouldMoney" size="30" value="@ViewBag.totalMoney" /> </p>
            <div class="divider">
            </div>
            <p><label>收款金额：</label> <input name="getMoney" id="getMoney" class="required" type="text" size="30" value="" alt="请输入金额" /> </p>
            <div class="divider">
            </div>
            <p><label>找零：</label> <input name="changeMoney" id="changeMoney" class="required" type="text" size="30" value="" /> </p>
        </div>
    <div class="formBar">
        <ul>
            <!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button id="PrintBtn" type="button">打印</button>
                    </div>
                </div>
            </li>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit">保存</button>
                    </div>
                </div>
            </li>
            <li>
                <div class="button">
                    <div class="buttonContent">
                        <button type="button" class="close">取消</button></div>
                </div>
            </li>
        </ul>
    </div>
    </form>
    <script type="text/javascript">
        $("#getMoney").change(function () {
            var totalMoney = $('#totalMoney').val();
            var getMoney = $('#getMoney').val();
            var shouldMoney = $('#ShouldMoney').val();
            var changeMoney = parseFloat(getMoney) - parseFloat(shouldMoney);
            var lmoney = parseFloat(totalMoney) - parseFloat(shouldMoney);
            $('#changeMoney').val(changeMoney);

            $('#youhui').text(lmoney);
            $('#shishou').text(shouldMoney);
            $('#shoukuan').text(getMoney);
            $('#zhaoling').text(changeMoney);


        });

        $('#LetMoney').change(function () {
            var totalMoney = $('#totalMoney').val();
            var letMoney = $('#LetMoney').val();
            var smoney = parseFloat(totalMoney) - parseFloat(letMoney);
            $('#ShouldMoney').val(smoney);

        });

        $('#ShouldMoney').change(function () {
            var totalMoney = $('#totalMoney').val();
            var sMoney = $('#ShouldMoney').val();
            var lmoney = parseFloat(totalMoney) - parseFloat(sMoney);
            $('#LetMoney').val(lmoney);
        });

        $('#PrintBtn').click(function () {
            CreatePrintPage();
            LODOP.PREVIEW();
            //LODOP.PRINTA();
            //return true;
        });

        function CreatePrintPage() {
            LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
            var strFormHtml = "<body>" + document.getElementById("printArea").innerHTML + "</body>";
            LODOP.PRINT_INIT("精诚科技");
            LODOP.ADD_PRINT_HTM(5, 2, 680, 1600, strFormHtml);
            LODOP.SET_PRINT_PAGESIZE(3, 680, 10, "");

        };
        
    </script>
</div>
